<div nz-form #myForm="ngForm" (ngSubmit)="onSubmit(myForm.value)" ngForm novalidate>
  <nz-form-item>
    <nz-form-label nzSm="3">用户名</nz-form-label>
    <nz-form-control nzSm="6">
      <input nz-input type="text" name="userName" ngModel value="" [class.hasError]="!userNameRequireValid" required minlength="6" (input)="inputValidate(myForm,'userName')" />
      <nz-form-explain [hidden]="userNameRequireValid">用户名是必填项</nz-form-explain>
      <nz-form-explain [hidden]="userNameMinlengthValid">用户名长度最小为6</nz-form-explain>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label nzSm="3">手机</nz-form-label>
    <nz-form-control nzSm="6">
      <input nz-input type="text" name="mobile" mobile value="" #mobile="ngModel" ngModel (input)="mobileValidate(myForm,'mobile')"/>
      <nz-form-explain [hidden]="mobileValid">手机不符合规则</nz-form-explain>
    </nz-form-control>
  </nz-form-item>
  <div ngModelGroup="pwdGroup" equal>
    <nz-form-item>
      <nz-form-label nzSm="3">密码</nz-form-label>
      <nz-form-control nzSm="6">
        <input nz-input type="password" name="pwd" value="" ngModel required minlength="6" />
      </nz-form-control>
    </nz-form-item>
    <nz-form-item>
      <nz-form-label nzSm="3">确认密码</nz-form-label>
      <nz-form-control nzSm="6">
        <input nz-input type="password" name="pwdConfirm" value="" ngModel />
        <nz-form-explain [hidden]="">密码与确认密码不匹配</nz-form-explain>
      </nz-form-control>
    </nz-form-item>
  </div>
  <nz-form-item>
    <nz-form-control nzSpan="6" nzOffset="3">
      <button type="submit" nz-button nzType="default">提交</button>
    </nz-form-control>
  </nz-form-item>
</div>
<p>{{myForm.value|json}}</p>
<p nzColor="#ff0000">{{mobile.value}}</p>
